/*
 * Copyright (c) 2023-2025 elsfs Authors. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.elsfs.cloud.common.mybatis.ext.db;

import com.baomidou.mybatisplus.core.metadata.IPage;
import org.elsfs.cloud.common.mybatis.ext.sql.support.executor.DeleteSqlExecutor;
import org.elsfs.cloud.common.mybatis.ext.sql.support.executor.InsertSqlExecutor;
import org.elsfs.cloud.common.mybatis.ext.sql.support.executor.QueryListSqlExecutor;
import org.elsfs.cloud.common.mybatis.ext.sql.support.executor.QueryOneSqlExecutor;
import org.elsfs.cloud.common.mybatis.ext.sql.support.executor.QueryPageSqlExecutor;
import org.elsfs.cloud.common.mybatis.ext.sql.support.executor.UnionSqlExecutor;
import org.elsfs.cloud.common.mybatis.ext.sql.support.executor.UpdateSqlExecutor;

/** SQL执行器工厂 */
public interface SqlExecutorFactory {

  /**
   * 查询单条数据
   *
   * @param clazz 数据项类
   * @return SQL执行器
   * @param <R> 数据类型
   */
  <R> QueryOneSqlExecutor<R> queryOne(Class<R> clazz);

  /**
   * 查询列表数据
   *
   * @param clazz 数据项类
   * @return SQL执行器
   * @param <R> 结果类型
   */
  <R> QueryListSqlExecutor<R> queryList(Class<R> clazz);

  /**
   * 查询分页数据
   *
   * @param pageable 分页对象
   * @param clazz 数据项类
   * @return SQL执行器
   * @param <R> 结果类型
   */
  <R> QueryPageSqlExecutor<R> queryPage(IPage<R> pageable, Class<R> clazz);

  /**
   * 联合数据查询
   *
   * @param clazz 数据项类
   * @return SQL执行器
   * @param <R> 结果类型
   */
  <R> UnionSqlExecutor<R> unionQuery(Class<R> clazz);

  /**
   * 插入数据
   *
   * @return SQL执行器
   */
  InsertSqlExecutor insert();

  /**
   * 更新数据
   *
   * @return SQL执行器
   */
  UpdateSqlExecutor update();

  /**
   * 删除数据
   *
   * @return SQL执行器
   */
  DeleteSqlExecutor delete();
}
